<template>
  <div class="app-container">
    <!-- 顶部搜索区域 -->
    <el-form ref="searchClassFormRef" :model="getClassQueryInfo" :inline="true" class="demo-form-inline">
      <el-form-item prop="clbum_name">
        <el-input v-model="getClassQueryInfo.clbum_name" placeholder="班级名称" />
      </el-form-item>
      <el-form-item prop="charge_teacher_name">
        <el-input v-model="getClassQueryInfo.charge_teacher_name" placeholder="班主任名字" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="queryInput">查询</el-button>
        <el-button @click="restLess">重置</el-button>
      </el-form-item>
    </el-form>
    <div class="xinjianbanjiBtn">
      <el-button type="success" @click="addActivites">新建班级</el-button>
    </div>
    <!-- 班级教室展示区域 -->
    <tableModule :classShowTable="classShowTable" :getClassInfo="getClassInfo"></tableModule>
    <!-- 分页 -->
    <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="page"
        :page-sizes="[10, 20, 30, 40]"
        :page-size="limit"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total">
    </el-pagination>
    <!-- 新增&&编辑 -->
    <el-dialog :title="dialogTitle" :visible.sync="addClassDialogVisible" width="53%" :before-close="resetClassFormAndFalse">
          <el-form ref="addClassformRef" :model="addClassForm" :rules="addFormRefRules" label-width="150px">
            <div class="xinjianbanjiDIV">
              <div style="margin-left: 30px;">
                <div class="xinzengbanjiFOrmItem">
                  <el-form-item label="班级名称" prop="clbum_name">
                    <el-input v-model="addClassForm.clbum_name" />
                  </el-form-item>
                </div>
                <div class="xinzengbanjiFOrmItem">
                  <el-form-item label="班主任名字" prop="charge_teacher_name">
                    <el-select v-model="headTeacher">
                      <el-option v-for="(item, i) in teacherData" :key="i" :value="i" :label="item.nickname" />
                    </el-select>
                  </el-form-item>
                </div>
                <el-form-item label="任课老师姓名" prop="instructor_name">
                  <div class="selectDIV">
                    <el-select v-model="renkelaoshi">
                      <el-option v-for="(item, i) in teacherData" :key="i" :value="i" :label="item.nickname" />
                    </el-select>
                  </div>
                </el-form-item>
                <el-form-item label="课程" prop="lession_id">
                  <el-select v-model="addClassForm.lession_id" placeholder="请选择课程">
                    <el-option
                      v-for="(item, index) in courseShowTable"
                      :key="index"
                      :label="item.lession.lession_name"
                      :value="item.lession_id"
                    />
                  </el-select>
                </el-form-item>
                <el-form-item label="班级简介" prop="clbum_desc">
                  <el-input v-model="addClassForm.clbum_desc" type="textarea" />
                </el-form-item>
                <el-form-item label="上课时间：" prop="time">
                  <el-button type="success" size="medium" @click="addDateDialog = true">添加</el-button>
                </el-form-item>
              </div>
              <div class="xinjianbanjiDIV2">
                <div class="xinzengbanjiFOrmItem">
                  <el-form-item label="教室" prop="classroom_id">
                    <el-select v-model="jiaoshiObj" placeholder="请选择教室" @change="selection">
                      <el-option v-for="(item, i) in classroomShuzu" :key="i" :label="item.classroom_name" :value="i" />
                    </el-select>
                  </el-form-item>
                </div>
                <div class="xinzengbanjiFOrmItem">
                  <el-form-item label="学期" prop="semester_id">
                    <el-select v-model="xueqiSelect" placeholder="请选择学期ID">
                      <el-option v-for="(item, i) in semeteShuzu" :key="i" :value="i" :label="item.semester_name" />
                    </el-select>
                  </el-form-item>
                </div>
                <div class="banjj">
                  <el-form-item label="开课日期" prop="begin_time">
                    <el-date-picker v-model="startDate" type="date" placeholder="开始日期" :picker-options="pickerOptionsStart" value-format="yyyy-MM-dd HH:mm:ss" />
                  </el-form-item>
                </div>
                <div class="banjj">
                  <el-form-item label="结课日期" prop="end_time">
                    <el-date-picker v-model="endDate" type="date" placeholder="结束日期" :picker-options="pickerOptionsEnd" value-format="yyyy-MM-dd HH:mm:ss" />
                  </el-form-item>
                  <div class="xinzengbanjiFOrmItem">
                    <el-form-item label="助教名字" prop="assistant_teacher_name">
                      <el-select v-model="zhujiaolaoshi">
                        <el-option v-for="(item, i) in teacherData" :key="i" :value="i" :label="item.nickname" />
                      </el-select>
                    </el-form-item>
                  </div>
                </div>
              </div>
            </div>
            <div class="tableClass">
              <el-table border fit highlight-current-row :data="addClassForm.time">
                <el-table-column align="center" prop="day" label="星期" />
                <el-table-column align="center" prop="begin_time" label="开始时间" />
                <el-table-column prop="end_time" label="结束时间" align="center" />
                <el-table-column prop="time" label="上课时长" align="center" />
                <el-table-column align="center" prop="classroom_id" label="教室" />
              </el-table>
            </div>
          </el-form>
          <!-- 上课时间 -->
          <el-dialog width="80%" :before-close="addDateDialogClose" title="添加上课时间" :visible.sync="addDateDialog" append-to-bodystyle="margin-right: 48vw;">
            <el-form ref="addDateFormRef" :model="addDateForm" :rules="addDateFormRules" label-width="150px">
              <el-form-item prop="day" label="上课时间">
                <!-- 星期 -->
                <template>
                  <el-checkbox v-model="checkAll" :indeterminate="isIndeterminate" @change="handleCheckAllChange">全选</el-checkbox>
                  <div style="margin: 15px 0"></div>
                  <el-checkbox-group v-model="addDateForm.day" @change="handleCheckedCitiesChange">
                    <el-checkbox v-for="city in cities" :key="city" :label="city">{{ city
                    }}</el-checkbox>
                  </el-checkbox-group>
                </template>
              </el-form-item>
              <el-form-item label="选择作息" prop="timetable_id">
                <div class="xuanzeshijianduan">
                  <el-select v-model="zuoxiObj" placeholder="选择时间段">
                    <el-option v-for="(item,i) in timeshuzu" :key="item.unid" :label="item.timetable_name" :value="i" />
                  </el-select>
                </div>
              </el-form-item>
              <div class="xuanzejiaoshiDIB">
                <el-form-item label="上课教室" prop="classroom_id">
                  <el-select v-model="jiaoshiObj">
                    <el-option v-for="(item, i) in classroomShuzu" :key="i" :label="item.classroom_name" :value="i" />
                  </el-select>
                </el-form-item>
                <div>
                  <el-button type="primary" size="mini" @click="jiaoshiFreeTImeDIa=true">查看教室空闲时间</el-button>
                </div>
              </div>
              <el-form-item label="开始时间" prop="begin_time">
                <div class="kaishishijianDiv">
                  <el-input v-model="addDateForm.begin_time" disabled />
                </div>
              </el-form-item>
              <el-form-item label="结束时间" prop="end_time">
                <div class="kaishishijianDiv">
                  <el-input v-model="addDateForm.end_time" disabled />
                </div>
              </el-form-item>
              <el-form-item label="上课时长(分钟)" prop="time">
                <div style="width: 200px">
                  <el-input v-model="timeHourA" disabled />
                </div>
              </el-form-item>
            </el-form>
            <span slot="footer" class="dialog-footer">
              <el-button @click="addDateDialogClose()">取消</el-button>
              <el-button type="primary" @click="addDateFormToSuzu();addDateDialog = false;">添加</el-button>
            </span>
          </el-dialog>
          <!-- 新建班级DIALOG底部 -->
          <span slot="footer" class="dialog-footer">
            <el-button @click="resetClassFormAndFalse()">关闭</el-button>
            <el-button type="primary" @click="submitClass()">确 定</el-button>
          </span>
        </el-dialog>
    <!-- 教室空闲时间 -->
    <el-dialog width="100%" title="查看教室空闲时间" :visible.sync="jiaoshiFreeTImeDIa" append-to-bodystyle="margin-left: 55vw;">
          <el-form>
            <!-- 表格 -->
            <div v-if="jiaoshiObj">
              <!-- <span style="display: block;width: 200px;height: 50px;">学期: {{ semeteShuzu[xueqiSelect].semester_name }}</span> - --><span style="display: block;">当前查询教室: {{ classroomShuzu[jiaoshiObj].classroom_name }}</span>
            </div>
    
            学期开始 {{ xueqiBegin }} 学期结束 {{ xueqiEnd }}
            <el-table border style="width: 100%">
              <el-table-column align="center" label="教室名称" width="180"> 教室名称 </el-table-column>
              <el-table-column align="center" label="开始时间" width="180"> 开始时间 </el-table-column>
              <el-table-column align="center" label="结束时间"> 结束时间 </el-table-column>
            </el-table>
          </el-form>
          <span slot="footer" class="dialog-footer">
            <el-button @click="jiaoshiFreeTImeDIa=false">关闭</el-button>
          </span>
    </el-dialog>
    <!-- 查看 -->
  </div>
</template>
<script>
const cityOptions = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
import {
    searchSemeter, // 查询学期
    searchClassRoom, // 查询教室列表
    getTimeTable, // 获取时间表
    addClass, // 添加班级
    searchCourse, // 获取课程
    searchClass, // 获取班级列表
    editClass, // 获取班级信息
    getTeacherAPI, // 获取老师信息
    chajiaoshikongjianshijian, // 获取教室空闲时间信息
    getShijianduan // 获取作息时间段
} from '@/api/classManage'
import tableModule from "./components/table.vue"
import look from "./components/look.vue"
export default {
  components:{
  	tableModule,
  	look
  },
    data() {
        return {
            editDig:false,//编辑默认隐藏
            querySemester: null,
            formData: {
                LessName: '',
                classroom_num: ''
            }, // 顶部查询输入框
            allid: '', // 全局id
            dialogTitle: '', // 对话框标题
            // 编辑
            editForm: {
                unid: null,
                clbum_name: null,
                classroom_name: null,
                lession_id: null,
                semester_id: null,
                charge_teacher_id: null,
                charge_teacher_name: null,
                assistant_teacher_id: null,
                assistant_teacher_name: null,
                clbum_desc: null,
                begin_time: null,
                end_time: null,
                instructor_id: null,
                instructor_name: null,
                time: null,
                institution_id: null
            },
            seeDig: false, // 查看
            aaa: '',
            shijianduan: [],
            jiaoshiFreeTImeDIa: false,
            jiaoshiObj: '',
            zuoxiObj: '',
            renkelaoshi: '',
            headTeacher: '',
            zhujiaolaoshi: '',
            startDate: '',
            endDate: '',
            // 开始结束日期限制
            pickerOptionsStart: {
                disabledDate: time => {
                    if (this.endDate) {
                        return (time.getTime() < new Date(this.xueqiBegin).getTime() || time.getTime() > new Date(this.endDate)
                            .getTime() || time.getTime() > new Date(this.xueqiEnd).getTime())
                    } else {
                        return (time.getTime() < new Date(this.xueqiBegin).getTime() || time.getTime() > new Date(this.xueqiEnd)
                            .getTime())
                    }
                }
            },
            pickerOptionsEnd: {
                disabledDate: time => {
                    if (this.startDate) {
                        return (time.getTime() < new Date(this.startDate).getTime() || time.getTime() < new Date(this.xueqiBegin)
                            .getTime() || time.getTime() > new Date(this.xueqiEnd).getTime())
                    } else {
                        return (time.getTime() > new Date(this.xueqiEnd).getTime() || time.getTime() < new Date(this.xueqiBegin)
                            .getTime())
                    }
                }
            },
            xueqiSelect: '',
            xueqiBegin: '',
            xueqiEnd: '',
            dateTimeValue: [],
            // begintimeA: '06',
            // begintimeB: '30',
            // endintimeA: '14',
            // endintimeB: '30',
            // 上课时间复选框
            checkAll: false,
            checkedCities: [],
            cities: cityOptions,
            isIndeterminate: true,
            shijianshuzuaaa: [],
            getClassQueryInfo: {
                clbum_name: '',
                charge_teacher_name: ''
            },
            courseShowTable: [],
            teacherData: [],//老师数组
            teacherData1: [],
            teacherData2: [],
            timeshuzu: [],
            datecheck: [],
            shangkeTable: [],
            semeteShuzu: [],
            classroomShuzu: [], // 教室数据
            classShowTable: [],
            startTime: '',
            endTime: '',
            goumainum: '',
            checked: false,
            innerVisible: false,
            dataValue: '',
            editClassDialog: false,
            editClassForm: {},
            searchClassForm: {
                className: '',
                adviser_name: '',
                assistant_name: ''
            },
            queryInfo: {
                limit: 6,
                page: 1
            },
            queryId: {
                unid: ''
            },
            // 上课时长验证
            addDateFormRules: {
                day: [{
                    required: true,
                    message: '请输入日期',
                    trigger: 'blur'
                }],
                classroom: [{
                    required: true,
                    message: '请选择教室',
                    trigger: 'blur'
                }],
                timetable_id: [{
                    required: true,
                    message: '请选择作息表',
                    trigger: 'blur'
                }],
                begin_time: [{
                    required: true,
                    message: '请输入上课时间',
                    trigger: 'blur'
                }],
                end_time: [{
                    required: true,
                    message: '请输入下课时间',
                    trigger: 'blur'
                }],
                time: [{
                    required: true,
                    message: '不能为空',
                    trigger: 'blur'
                }]
            },
            addFormRefRules: {
                assistant_teacher_id: [{
                    required: false,
                    message: '请输入班级名字',
                    trigger: 'blur'
                }],
                clbum_desc: [{
                    required: false,
                    message: '请输入班级简介',
                    trigger: 'blur'
                }],
                dateTimeValue: [{
                    required: false,
                    message: '请输入开课日期',
                    trigger: 'blur'
                }],
                clbum_name: [{
                    required: true,
                    message: '请输入班级名字',
                    trigger: 'blur'
                }],
                classroom_id: [{
                    required: true,
                    message: '请选择教室',
                    trigger: 'blur'
                }],
                lession_id: [{
                    required: true,
                    message: '请选择课程',
                    trigger: 'blur'
                }],
                semester_id: [{
                    required: true,
                    message: '不能为空',
                    trigger: 'blur'
                }
                    // {
                    //     type: 'number',
                    //     message: '请输入数字',
                    //     trigger: 'change'
                    // }
                ],
                charge_teacher_id: [{
                    required: true,
                    message: '不能为空',
                    trigger: 'blur'
                }, {
                    type: 'number',
                    message: '请输入数字'
                }],
                charge_teacher_name: [{
                    required: true,
                    message: '不能为空',
                    trigger: 'blur'
                }],
                begin_time: [{
                    required: false,
                    message: '请选择开始时间',
                    trigger: 'blur'
                }],
                end_time: [{
                    required: false,
                    message: '请输入结束时间',
                    trigger: 'blur'
                }],
                instructor_id: [{
                    required: true,
                    message: '不能为空',
                    trigger: 'blur'
                }, {
                    type: 'number',
                    message: '请输入数字'
                }],
                instructor_name: [{
                    required: true,
                    message: '不能为空',
                    trigger: 'blur'
                }],
                time: [{
                    required: true,
                    message: '不能为空',
                    trigger: 'blur'
                }],
                assistant_teacher_name: [{
                    required: true,
                    message: '请输入助教名字',
                    trigger: 'blur'
                }],
                clbum_desc: [{
                    required: true,
                    message: '请输入班级简介',
                    trigger: 'blur'
                }]
            },
            page:1,
            limit:6,
            currentPage: 0, // 页数
            total: 0, // 总数
            classTable: [],
            addDateFormShuzu: [],
            // 上课时间数据
            addDateForm: {
                day: [],
                classroom_name: '',
                timetable_id: '',
                begin_time: '',
                end_time: '',
                time: ''
            },
            addClassForm: {
                clbum_name: '',
                classroom_id: '',
                lession_id: '',
                semester_id: '',
                charge_teacher_id: '',
                charge_teacher_name: '',
                assistant_teacher_id: '',
                assistant_teacher_name: '',
                clbum_desc: '',
                begin_time: '',
                end_time: '',
                instructor_id: '',
                instructor_name: '',
                time: []
            },
            timeForm: {
                day: '',
                classroom: ''
            },
            addDateDialog: false,
            addClassDialogVisible: false
        }
    },
    computed: {
        // 上课时长
        timeHourA: function() {
            if (!this.addDateForm.begin_time || !this.addDateForm.end_time) {
                return 0
            } else {
                return this.jisuantime(this.addDateForm.begin_time, this.addDateForm.end_time, this.aaa)
            }
        }
    },
    watch: {
        headTeacher: {
            handler: function() {
                this.addClassForm.charge_teacher_name = this.teacherData[this.headTeacher].nickname
                this.addClassForm.charge_teacher_id = this.teacherData[this.headTeacher].id
            }
        },

        // 作息
        zuoxiObj: {
            handler: function() {
                console.log('------------作息')
                const rs = this.timeshuzu[this.zuoxiObj]
                this.addDateForm.timetable_id = this.timeshuzu[this.zuoxiObj].unid
                this.getShijianduan(rs.unid)
                console.log(rs)
                this.addClassForm.teacher_name = rs.nickname
                this.xueqiBegin = rs.start_time
                this.xueqiEnd = rs.end_time
                console.log('-------xueqibegin')
                console.log(this.xueqiBegin)
                console.log('-------xueqiend')
                console.log(this.xueqiEnd)
                console.log(this.addClassForm)
            }
        },
        // 开课日期
        dateTimeValue: {
            handler: function() {
                this.addClassForm.begin_time = this.dateTimeValue[0]
                this.addClassForm.end_time = this.dateTimeValue[1]
            },
            deep: true
        },
        // 上课教室
        jiaoshiObj: {
            handler: function() {
                this.addClassForm.classroom_id = this.classroomShuzu[this.jiaoshiObj].unid
                console.log('教室id----------------')
                console.log(this.addClassForm.classroom_id)
                this.chajiaoshikongxianshijian(this.addClassForm.classroom_id)
            }
        },
        // 学期
        xueqiSelect: {
            handler: function() {
                const rs = this.semeteShuzu[this.xueqiSelect]
                this.addClassForm.semester_id = rs.unid
                console.log('------------xueqi')
                console.log(rs)
                // this.addClassForm.teacher_name = rs.nickname
                this.xueqiBegin = rs.start_time
                this.xueqiEnd = rs.end_time
                console.log('-------xueqibegin')
                console.log(this.xueqiBegin)
                console.log('-------xueqiend')
                console.log(this.xueqiEnd)
                // console.log(this.addClassForm)
            }
        },
        startDate: {
            handler: function() {
                if (!this.addClassForm.semester_id) {
                    this.$message.error('请先选择学期')
                    this.startDate = ''
                    this.endDate = ''
                }
            }
        },
        renkelaoshi: {
            handler: function() {
                console.log('老师---------------', this.renkelaoshi)
                // console.log(this.teacherData)
                // const rs = JSON.parse(
                //     JSON.stringify(this.teacherData[this.renkelaoshi])
                // )
                // console.log(rs)
                // console.log(this.teacherData[this.renkelaoshi])
                this.addClassForm.instructor_name = this.teacherData[this.renkelaoshi].nickname
                this.addClassForm.instructor_id = this.teacherData[this.renkelaoshi].id
                console.log('任课---------------')
                console.log(this.addClassForm.instructor_name)
                console.log(this.addClassForm.instructor_id)
                // this.addClassForm.instructor_id = rs.id
            }
        },
        zhujiaolaoshi: {
            handler: function() {
                this.addClassForm.assistant_teacher_name = this.teacherData[this.zhujiaolaoshi].nickname
                this.addClassForm.assistant_teacher_id = this.teacherData[this.zhujiaolaoshi].id
                // const rs = this.teacherData[this.renkelaoshi]
                // this.addClassForm.assistant_teacher_name = rs.nickname
                // this.addClassForm.assistant_teacher_id = rs.id
                console.log('---------助教')
                // console.log(this.renkelaoshi)
                console.log(this.addClassForm.assistant_teacher_name)
                console.log(this.addClassForm.assistant_teacher_id)
            }
        }
    },
    created() {
        // this.searchClassRoomList() // 教室列表
        this.getSemeter() // 查询学期
        // this.getTimeTableA() // 获取时间表
        this.getCourseTable() // 查询课程
        this.getClassInfo() // 查询班级
        this.getTeacherAPI() // 查询老师
    },
    methods: {
      //分页
      handleSizeChange(val) {
      	console.log(`每页 ${val} 条`);
      	this.limit = val
      	this.getClassInfo()
      },
      handleCurrentChange(val) {
      	console.log(`当前页: ${val}`);
      	this.page = val
      	this.getClassInfo()
      },
        // 点击添加活动
        addActivites() {
            this.addClassDialogVisible = true
            this.dialogTitle = '新增班级'
        },
        // 取消按钮新增
        resetClassFormAndFalse() {
            this.$refs.addClassformRef.resetFields()
            this.addClassDialogVisible = false
        },
        // 下拉框事件
        selection(val) {
            this.$forceUpdate()
        },
        // 计算时间相差分钟
        jisuantime(beginTIme, endTIme, rs) {
            // var date1 = new Date(beginTIme) // 开始时间
            // var date2 = new Date(endTIme) // 结束时间
            // var date3 = date2.getTime() - date1.getTime() // 时间差的毫秒数
            // var date3 = (endTIme - beginTIme) * 1000 // 时间差的毫秒数
            // var date1 = data2 - data1

            var start1 = beginTIme.split(':')
            console.log(start1)
            var startAll = parseInt(start1[0] * 60) + parseInt(start1[1])

            var end1 = endTIme.split(':')
            var endAll = parseInt(end1[0] * 60) + parseInt(end1[1])
            rs = endAll - startAll
            // console.log('时间差===' + (endAll - startAll))

            // console.log('开始时间')
            // console.log(beginTIme)
            // console.log(date2)
            // console.log(date1)

            // rs = 480
            return rs
        // var date2 = new Date(endTIme)
        // var date3 = date2.getTime() - date1.getTime()
        },
        // 获取作息时间段
        async getShijianduan(id) {
            let qqq = {
                unid: ''
            }
            qqq.unid = id
            const rs = await getShijianduan(qqq)
            if (rs.code !== 200) return
            console.log('作息时间段')
            console.log(rs.data)
            const cw = rs.data[0].main.length - 1
            console.log(rs.data[0].main.length)
            this.addDateForm.begin_time = rs.data[0].main[0].begin_time
            this.addDateForm.end_time = rs.data[0].main[cw].end_time
        },
        // 上课时间提交
        addDateFormToSuzu() {
            this.addDateForm.begin_time = this.begintimeA + ':' + this.begintimeB
            this.addDateForm.end_time = this.endintimeA + ':' + this.endintimeB
            this.addDateForm.time = this.timeHourA
            this.addDateForm.classroom_id = this.classroomShuzu[this.jiaoshiObj].classroom_name
            var newData = []
            // console.log(this.addDateForm)
            this.$refs.addDateFormRef.validate(valida => {
                if (!valida) return
                else {
                    this.addClassForm.time.push(JSON.parse(JSON.stringify(this.addDateForm)))
                    console.log(this.addClassForm.time)
                }
            })
        },
        // 星期全选
        handleCheckAllChange(val) {
            this.addDateForm.day = val ? cityOptions : []
            this.isIndeterminate = false
        },
        handleCheckedCitiesChange(val) {
            let checkedCount = val.length
            this.checkAll = checkedCount === this.cities.length
            this.isIndeterminate = checkedCount > 0 && checkedCount < this.cities.length
        },
        // 计算时间差（相差分钟）
        timeDifference(startTime, endTime) {
            var start1 = startTime.split(':')
            var startAll = parseInt(start1[0] * 60) + parseInt(start1[1])
            var end1 = endTime.split(':')
            var endAll = parseInt(end1[0] * 60) + parseInt(end1[1])
            console.log('时间差===' + (endAll - startAll))
            return endAll - startAll
        },
        // 关闭上课时长对话框
        addDateDialogClose() {
            this.$refs.addDateFormRef.resetFields()
            this.addDateDialog = false
        },
        // 查询班级
        async getClassInfo(){
          let resData = {
          	page:this.page,
          	limit:this.limit,
            clbum_name: this.getClassQueryInfo.clbum_name,
            charge_teacher_name: this.getClassQueryInfo.charge_teacher_name,
          }
          console.log(resData)
          let data = await searchClass(this.resData)
            if(data.code == 200){
              console.log('班级列表')
              console.log(data.data)
            	this.total = data.data.total
            	this.currentPage = data.data.current_page
            	this.classShowTable = data.data.list
            	console.log(this.classShowTable);
            }
        },
        // 查询教室空闲时间
        async chajiaoshikongxianshijian(unid) {
            console.log(unid)
            console.log('查询教室空闲时间')
            let qqq = {
                unid: '',
                start_time: '',
                end_time: ''
            }
            qqq.start_time = this.addClassForm.begin_time
            qqq.end_time = this.addClassForm.end_time
            qqq.unid = unid
            const rs = await chajiaoshikongjianshijian(qqq)
            console.log(rs)
        },
        // 查询课程
        async getCourseTable() {
            let form = {}
            var resData = await searchCourse(form)
            if (resData.code !== 200) return
            console.log('收费课程')
            console.log(resData.data)
            this.courseShowTable = resData.data
        },
        // 查询老师
        async getTeacherAPI() {
            let form = {}
            var resData = await getTeacherAPI(form)
            if (resData.code !== 200) return
            this.teacherData = resData.data
            console.log('任课老师')
            console.log(this.teacherData)
            this.teacherData = resData.data
        },
        // 查询学期
        async getSemeter() {
            let queryInfo = {}
            var resData = await searchSemeter(queryInfo)
            if (resData.code !== 200) return
            console.log('学期列表')
            console.log(resData.data)
            this.semeteShuzu = resData.data
        },
        //头部输入框搜索
        queryInput(){
        	this.getClassInfo()
        },
        // 重置
        async restLess () {
          this.getClassQueryInfo.clbum_name = null
          this.getClassQueryInfo.charge_teacher_name = null
          this.$message.success('重置成功！')
          this.getClassInfo()
        },
    }
}
</script>
<style scoped lang="scss">
  .el-date-editor {
    width: 100%;
  }
  .el-select {
    width: 100%;
  }
  .selectDIV {
    width: 210px;
  }
  .banjj {
    width: 359px;
  }
  .jieshushijianSelect {
    margin-left: 20px;
  }
  .bottomPaginationaa {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 50px;
  }
  .xinjianbanjiBtn {
    margin-bottom: 12px;
  }
  .xinzengbanjiFOrmItem {
    width: 360px;
  }
  .xinjianbanjiDIV {
    display: flex;
  }
  .jihuakeshiDiv {
    width: 300px;
  }
  .zigoumai[data-v-b975e2d4] {
    display: flex;
    span {
      width: 50px;
      margin: 0 10px 0 10px;
    }
    margin-left: 31px;
    font-weight: 600;
  }
  .xuanzeriqi {
    margin: 0 0 0 12px;
  }
  .tianjiashangkeshijianDIAlogo {
    margin-left: 10px;
    .gongzuotianDiv {
      display: flex;
    }
    .gongzuotianDiv15 {
      display: flex;
      margin-left: 10px;
      div {
        margin-left: 10px;
      }
    }
    .zhoumoDiv {
      display: flex;
    }
    .zhoumo67 {
      display: flex;
      margin-left: 10px;
      div {
        margin-left: 10px;
      }
    }
  }
  .zitiColor {
    color: #169bd5;
  }
  .tableClass {
    width: 100%;
  }
  .shijianxuanzeDIv {
    display: flex;
    .el-date-editor[data-v-b975e2d4] {
      margin-left: 20px;
    }
    // :nth-child(1){
    //   margin-left:20px ;
    // }
    // :nth-child(2){
    //   margin-left:20px ;
    // }
  }
  .xuanzejiaoshiDIB {
    display: flex;
    align-items: center;
    :nth-child(2) {
      margin-left: 20px;
      height: 40px;
    }
  }
  .el-form-item {
    margin-bottom: 18px;
  }
  .xuanzeshijianduan {
    width: 200px;
  }
  .kaishishijianDiv {
    display: flex;
    width: 200px;
    :nth-child(1) {
      border-radius: 4px;
      border: 1px solid #dcdfe6;
      width: 200px;
      height: 40px;
    }
    :nth-child(2) {
      margin: 0 12px 0 12px;
    }
    :nth-child(3) {
      width: 55px;
      height: 40px;
      border-radius: 4px;
      border: 1px solid #dcdfe6;
    }
  }
  .dataPicker {
    width: 350px;
  }
  .xinjianbanjiDIV2 {
    margin-left: 36px;
  }
  .el-dialog__footer {
    padding: 10px 50px 20px;
    text-align: right;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
  }
</style>
